#include <iostream>
#include<vector>
using namespace std;
string s;
bool solve() {
    vector<int> v;
    int len = s.size();
    for (int i = 0; i < len; i++) {
        if (s[i] != 'l' && s[i] != 'q' && s[i] != 'b') v.push_back(i);
    }
    if (v.size() == 0) return true;
    int left = v[0], right = v[v.size() - 1], l = v[0], r = v[v.size() - 1];
    while (left <= right && s[left] == s[right]) { left++; right--; } 
    while (l >= 0 && r < len && s[l] == s[r]) { l--; r++; }
    return left > right && l < 0;
}
int main()
{
    int t; cin >> t;
    while (t--) {
        cin >> s;
        if (solve()) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}。